package com.java3y.sso.handler;

import com.java3y.sso.annotate.InfrawInputListEqualsCheck;

import java.lang.annotation.Annotation;

public class InfrawInputListEqualsCheckImpl implements InfrawInputHandler {

    @Override
    public void handle(Object o, Annotation filedAnnotation, String filedName, String... str) throws Exception {

        // 判断这个值，在不在这个 数组里面
        if (filedAnnotation instanceof InfrawInputListEqualsCheck) {

            InfrawInputListEqualsCheck annotation = (InfrawInputListEqualsCheck) filedAnnotation;

            String[] value = annotation.value();

            boolean flag = true;
            for (String s : value) {
                if (s.equals(o)) {
                    flag = false;
                    break;
                }

            }
            if (flag) {
                throw new Exception("这里面没有你要的值啊");
            }

        }


    }
}
